package cn.demoxy.service;

import cn.demoxy.mapper.DemoUserMapper;
import cn.demoxy.model.dto.DemoUserDTO;
import cn.demoxy.model.entity.DemoUser;
import cn.demoxy.model.vo.DemoUserVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.catalina.User;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * @auther demo
 * @date 2022/5/17 21:43
 * 用户表业务层
 */
public interface IDemoUserService extends IService<DemoUser> {
    /**
     * 根据条件分页查询用户列表
     * @param userDTO
     * @return
     */
    Page<DemoUser> findAllUserByKeyword(DemoUserDTO userDTO);


    /**
     * 根据用户名查询用户
     * @param username
     * @return
     */
    DemoUser findByUserName(String username);

    /**
     * 所有用户信息excel导出
     * @param response
     */
    void exportData(HttpServletResponse response);

    /**
     * excel用户导入数据库
     * @param file
     */
    void importUserData(MultipartFile file);

    /**
     * 新增用户
     * @param user
     * @return
     */
    boolean saveUser(DemoUser user);

    /**
     * 更新用户
     * @param user
     * @return
     */
    boolean update(DemoUser user);

    /**
     * 用户登录
     * @param userDTO
     * @return
     */
    Map<String,Object> login(DemoUserDTO userDTO);

    /**
     * 分页查询所有在线用户
     * @param userDTO
     * @return
     */
    Page<DemoUser> findAllOnlineUser(DemoUserDTO userDTO);

    /**
     * 根据用户名强制登出用户
     * @param username
     * @return
     */
    boolean forcedReturnById(String username);
}
